import React from 'react'
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
import App from '../App'
import Dashboard from '../pages/Dashboard'
import GatewayConfig from '../pages/GatewayConfig'
import RouteManagement from '../pages/RouteManagement'
import UserManagement from '../pages/UserManagement'

// 路由配置
const router = createBrowserRouter([
  {
    path: '/',
    element: <App />,
    children: [
      {
        index: true,
        element: <Dashboard />
      },
      {
        path: 'gateway',
        element: <GatewayConfig />
      },
      {
        path: 'routes',
        element: <RouteManagement />
      },
      {
        path: 'users',
        element: <UserManagement />
      }
    ]
  }
])

// 路由提供者组件
function Router() {
  return <RouterProvider router={router} />
}

export default Router